function test() {
	alert("hello world");

	var name = "张晋源";
	var age = 20;
	console.log(`${name}永远${age}岁`);

	//The method of strings
	var test = "This is a good choice to go to CQUT.";
	console.log(test.length);
	console.log(test.toUpperCase());
	console.log(test.toLowerCase);
	console.log(test.substring(0, 10));

	//Array
	var number = ["112", "115", "bilibili"];
	console.log(number);
	console.log(number.length);
	console.log(number[1]);
	number.push("alibaba");
	console.log(number);
	number.sort();

	console.log(arr.join("-"));

	var a = ["重庆", "Beijing", "Shanghai"];
	a.forEach(function (place) {
		console.log(`The place is ${place}`);
	});

	var student = {
		id: 1,
		name: "张晋源",
		city: "guangdong",

		showSelfInfo: function () {
			console.log(`My name is ${name}, and my age is ${age}.This is my hometown, I love ${city} very much.`);
		},
	};
	console.log(student);
	console.log(student.name);
	console.showSelfInfo();

	var m = new Map([
		["Chongqing", 1],
		["Beijing", 2],
		["Shanghai", 2],
	]);

	m.set("Tianjin", "end");
	m.set("NewYork", "American");

	console.log(map);

	m.forEach(function (value, key, map) {
		console.log(`The value is what ${value}`);
		console.log(`The key is what ${key}`);
		console.log(`The value is what ${map}`);
	});

	// Set
	var set = new Set();
	set.add(5);
	set.add(8);

	console.log(set);

	//Operator
	console.log(5 / 3);
	console.log(-5 % 3);

	console.log(1 == "1");
	console.log([1, 2, 3] == new Array(1, 2, 3));
	console.log([1 == 1]);
	console.log(null == undefined);
	console.log(null === undefined);
	// NaN is not equal to any value
	console.log(NaN == NaN);

	//Judgement
	var age = 18;
	if (age <= 18) {
		console.log("Juvenile");
	} else if (age > 18 && age <= 40) {
		console.log("Middle age");
	} else {
		console.log("Old age");
	}

	//For loop
	var i;
	for (i = 0; i < arr.length; i++) {
		console.log(arr[i]);
	}
	// For - in
	for (var i in arr) {
		console.log(i);
		console.log(arr[i]);
	}
	// For - of
	for (var item of arr) {
		console.log(item);
	}
	// For - each
	arr.forEach(function (item) {
		console.log(item);
	});

	//Variable and Constant
	// Variable
	var province = "ChongQing";
	const PI = 3.1415926;

	//Function and method
	function Test(params) {
		console.log(`The params is ${params}`);
	}

	//Arrow Function
	var elements = ["Beijing", "ChongQing", "Shanghai"];
	elements.map((element) => {
		return element.length;
	});
	/*
    Return this:
    [8, 6, 7, 9]
    */
	// The use of arrow functions —— Call and apply
	Math.max.apply(null, [3, 4, 5, 6]);
	// 6
	Math.max.call(null, 3, 4, 5, 6);
	// 6
	//High level function
	var arr2 = [1, 3, 5, 4, 2, 9, 6];
	arr2.forEach((item) => console.log(item));
	//Package
	var arr1 = arr2.map((item) => item * 3);
	console.log(arr1);

	//Accumulate
	var sum = 0;
	arr2.forEach(function (item) {
		sum += item;
	});
	console.log(sum);

	console.log(arr2.reduce((a, b) => a + b));

	// Element filter
	console.log(arr2.filter((item) => item % 2 == 0));

	// Sort
	console.log(arr2.sort((a, b) => a - b));

	//Date
	var date = new Date(1615146562875);
	console.log(date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate());

	// Regex
	var reg = /ABC\-001/;
	console.log(reg.test("http://www.sfac.xyz:8000/notes/UI/Html.html"));

	//JSON
	console.log(student);
	//Serialization
	console.log(JSON.stringify(student));
}
